package com.example.demo.controller;


import com.example.demo.ResBean.constant.ResCode;
import com.example.demo.entity.response.Response;
import com.example.demo.entity.sqlbean.ProjectApplication;

import com.example.demo.service.CheckTheService;
import com.example.demo.utils.JsonUtil;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

//@Api(tags ="查看接口")
@RestController
@RequestMapping("/Check")
@CrossOrigin(origins = "*", maxAge = 3600)
public class CheckTheController {

    @Autowired
    CheckTheService checkTheService;


    @RequestMapping("project")
    public Response getViewingProjectApplications(@RequestParam String data) {
        Response response = new Response();
        ProjectApplication projectApplication = JsonUtil.getInstance().jsonToBean(data, ProjectApplication.class);
        if (projectApplication != null) {
            response = checkTheService.fnViewProjectApplications(projectApplication);
        } else {
            response.setCode(ResCode.Param_ilegal_code);
            response.setMessage(ResCode.Param_ilegal_str);
        }
        return response;
    }
}
